package com.yh.ldzl.config.websocket;

/**
 * WebSocket消息类，用于封装发送给客户端的消息
 *
 * @param <T> 消息数据类型
 */
public class WebSocketMessage<T> {
    /**
     * 消息类型
     */
    private String type;
    
    /**
     * 消息内容
     */
    private String message;
    
    /**
     * 消息数据
     */
    private T data;
    
    /**
     * 时间戳
     */
    private long timestamp;

    public WebSocketMessage() {
        this.timestamp = System.currentTimeMillis();
    }

    public WebSocketMessage(String type, String message, T data) {
        this.type = type;
        this.message = message;
        this.data = data;
        this.timestamp = System.currentTimeMillis();
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}
